package com.drug.common.exception;

/**
 * @author Alexlyn
 * @Date 2021/12/10 10:00
 * @Description: 通用异常
 * @Version 1.0
 */
public final class CommonException extends RuntimeException {

    private static final long serialVersionUID = -1237750119042142499L;
    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误提示
     */
    private String message;


    /**
     * 空构造方法，避免反序列化问题
     */
    public CommonException() {
    }

    public CommonException(String message) {
        this.message = message;
    }

    public CommonException(String message, Integer code) {
        this.message = message;
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public Integer getCode() {
        return code;
    }

    public CommonException setMessage(String message) {
        this.message = message;
        return this;
    }

}